package agents;

import game.constants.ReferenceAgent;
import interfaces.impl.Agent;
import objects.WorldObject;
import universe.Universe;


public class UniverseAgentWin extends Agent{

	@Override
	public void initializeActionList() {
		
		
	}

	@Override
	public void initializeSpecialFeatures() {
		
		
	}

	@Override
	public void initializeName() {
		name="universe agent win";
		
	}

	@Override
	public void initializeId() {
		this.id=ReferenceAgent.UNIVERSE_AGENT_WIN;
		
	}

	@Override
	public void updateChild(WorldObject object, Universe universe, double time) {
		
		int winner1=0;
		int winner2=0;
		
		for (WorldObject obj : universe.getListObjects()){
			if(winner1!=0 && winner2!=0){
				return;
			}
			if(obj.getOwner()==1){
				winner1++;
			}
			if(obj.getOwner()==2){
				winner2++;
			}
		}
		
		if(winner1==0){
			universe.generateDialogMessage(1, "HAS PERDIDO");
			universe.generateDialogMessage(2, "HAS GANADO");
		}
		if(winner2==0){
			universe.generateDialogMessage(2, "HAS PERDIDO");
			universe.generateDialogMessage(1, "HAS GANADO");
		}
		isActive=false;
	}
	
	

}
